package com.example.demo.all.sse;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import java.util.Map;

/**
 * @author zwg
 * @date 2025/2/27 16:43
 */
@Slf4j
public class CleanSseEmitterThread implements Runnable {
    String sseId;

    public CleanSseEmitterThread(String sseId) {
        this.sseId = sseId;
    }
    @Override
    public void run() {
        log.info("clean sseEmitter :{} map.size:{}",sseId, SseEmitterCache.emitterMap.size());
        SseEmitterCache.emitterMap.remove(sseId);
    }
}
